import {Entity, PrimaryGeneratedColumn, Column, Timestamp, OneToMany} from 'typeorm'


@Entity({name: 'catalog'})
export class CatalogEntity {
    @PrimaryGeneratedColumn({comment: '主键id'})
    id: number;

    @Column({comment: '书本id'})
    bookId: number;

    @Column({comment: '章节'})
    title: string;

    @Column({comment: '章节标题'})
    subtitle: string;

    @Column({comment: '批注数量'})
    annotationCount: number;

    @Column({type: 'timestamp', default: () => 'current_timestamp'})
    bookTime: Timestamp;

    @Column({type: 'timestamp', default: () => 'current_timestamp'})
    createTime: Timestamp;

    @Column({type: 'timestamp', onUpdate: 'current_timestamp', default: () => 'current_timestamp'})
    updateTime: Timestamp;
}